/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2019 HUST Dian Group
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Original Author: Pengyu Liu <eicliupengyu@gmail.com>
 */

#pragma once
#include <unordered_map>
#include "ns3/robo-base.h"
#include "ns3/node-container.h"

namespace ns3 {
struct RoboInTeamConfig
{
  RoboType type;
  std::string name;
  FVector location;
  FAngle rotation;
};
typedef std::vector<RoboInTeamConfig> RoboTeamConfig;

class RoboTeamHelper
{
  uint8_t m_teamId;
  FVector m_initLocation;
  FAngle m_initRotation;
  std::vector<Ptr<RoboBase>> m_robo;
  Ptr<RoboSupply> m_supply;
  NodeContainer m_nodes;
  std::unordered_map<std::string, uint8_t> m_name2uid;
  std::unordered_map<uint8_t, uint32_t> m_uid2idx;

public:
  RoboTeamHelper ();
  ~RoboTeamHelper ();
  void Init (uint8_t teamId, FVector location, FAngle rotation, RoboTeamConfig cfgs);
  Ptr<Node> GetNodeOf (std::string name);
  Ptr<Node> GetNodeOf (uint8_t uid);
  Ptr<RoboBase> GetRoboOf (std::string name);
  Ptr<RoboBase> GetRoboOf (uint8_t uid);
  NodeContainer &GetNodes ();
  uint8_t GetTeamId ();
};

} // namespace ns3
